package com.topnav.mc.uitls;

import com.js.lib.cache.Cache;
import com.js.lib.cache.SysCache;

/**
 * @Author: kenny
 * @Date: 2024/2/18 15:48
 */
public class GbServerUtil {
    /**
     * 配置文件里是否配置了WVPServer
     * @return
     */
    public static String get(){
        String ipPort = (String) SysCache.getInstance().get("gb-server");
        if (ipPort == null){
            return null;
        }
        return "http://" + ipPort;
    };

    public static void set(String ipPort){
        SysCache.getInstance().set("gb-server",ipPort);
        SysCache.getInstance().set("gb-server-ip",ipPort.split(":")[0]);
        SysCache.getInstance().set("gb-server-port",ipPort.split(":")[1]);
    };

    public static void remove(){
        SysCache.getInstance().del("gb-server");
        SysCache.getInstance().del("gb-server-ip");
        SysCache.getInstance().del("gb-server-port");
    }

    public static String getIp(){
        return (String) SysCache.getInstance().get("gb-server-ip");
    }
    public static String getPort(){
        return (String) SysCache.getInstance().get("gb-server-port");
    }
}
